package com.demo.enumDemo;

/**
 * created by yehao on 2018/7/19.
 */
public enum Weekday {
    MON(1),TUS(2),WED(3),THU(4),FRI(5),SAT(6),SUN(0);

    int value;
    private Weekday(int value){
        this.value=value;
    }

    public static Weekday getNetDay(Weekday nowday) {
        int nextDayValue = nowday.value;
        if (++nextDayValue == 7) {
            nextDayValue = 0;
        }
        return getnowValue(nextDayValue);
    }

    public static Weekday getnowValue(int value){
        for (Weekday c:Weekday.values()){
            if (c.value==value){
                return c;
            }
        }
        return null;
    }

}
